#include "orangepch.h"
#include "OrthogonaCamera.h"
#include "glm/gtc/type_ptr.hpp"

// camera
namespace Orange {
    OrthogonaCamera::OrthogonaCamera(float left , float right , float bottom , float top):m_PrejectMatrix(glm::ortho(left,right,bottom,top,-1.0f,1.0f)), m_ViewMatrix(1.0f) {
        m_ViewPrejectMatrix = m_PrejectMatrix * m_ViewMatrix;
    }
     void OrthogonaCamera::CalcViewPrejectMatrix(){
         glm::mat4 transform = glm::translate(glm::mat4(1.0f),m_Position)
         * glm::rotate(glm::mat4(1.0f),glm::radians(m_Rotation),glm::vec3(0.0f,0.0f,1.0f));

         m_ViewMatrix = glm::inverse(transform);
         m_ViewPrejectMatrix = m_PrejectMatrix * m_ViewMatrix;

     };
}